/*
 * @lc app=leetcode.cn id=657 lang=cpp
 *
 * [657] 机器人能否返回原点
 */

// @lc code=start
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
    bool judgeCircle(string moves)
    {
        int u = 0, l = 0;
        for (auto c : moves)
        {
            switch (c)
            {
            case 'U':
                u++;
                break;
            case 'D':
                u--;
                break;
            case 'R':
                l--;
                break;
            case 'L':
                l++;
                break;
            default:
                break;
            }
        }
        return (u==0)&&(l==0);
    }
};
// @lc code=end
